using System;
using System.Text;
using System.Collections;
using System.Reflection;

namespace Open.Data.Persistence
{
	public class Aggregate: Column, IAggregate
	{
		private AggregateType _aggregateType;

        //Constructors
        public Aggregate(Type type, string field): base(type, field)
        {
            AggregateType = AggregateType.Unique;
        }

        public Aggregate(Type type, string field, AggregateType aggregate): base(type, field)
        {
            AggregateType = aggregate;
        }

        //Properties
		public virtual AggregateType AggregateType
		{
			get
			{
				return _aggregateType;
			}
			set
			{
                _aggregateType = value;
			}
		}

        //Overrides
        public override void AppendHashCode(StringBuilder builder)
        {            
            builder.Append(PropertyInfo.ToString());
            builder.Append(_aggregateType.ToString());
        }
	}
}
